import os
import openai



openai.api_key = "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"

askInfo = input('--- ask: ')
# 聊天
response = openai.Completion.create(
  model="text-davinci-003",
  prompt=askInfo,
  temperature=0.7,
  max_tokens=2560,
  top_p=1,
  frequency_penalty=0,
  presence_penalty=0
)
print(response)


# import requests as req
# from PIL import Image
# from io import BytesIO

# 绘制图片
# response = openai.Image.create(
#     prompt=askInfo,
#     n=1,
#     size="512x512"
# )
# print(response)
# image_url = response['data'][0]['url']
# print(image_url)

# response = req.get(image_url)
# image = Image.open(BytesIO(response.content))
# image.show()